package com.study.kafkademo01.controller;

import com.study.kafkademo01.service.KafkaProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author weixiaochun
 */
@RestController
public class KafkaProducerController {

    @Resource
    private KafkaProducerService kafkaProducerService;

    /**
     * 发送消息简易版
     * @param message
     * @return
     */
    @GetMapping("/sendMessage")
    public String sendMessage(@RequestParam("message") String message){
        kafkaProducerService.sendMessage(message);
        return "success";
    }

}
